(global.webpackJsonp = global.webpackJsonp || []).push([
  ["pages/address/address-edit"], {
    "0fa7": function (t, e, n) {
      n.r(e);
      var r = n("d79e"),
        i = n("67cd");
      for (var a in i) "default" !== a && function (t) {
        n.d(e, t, function () {
          return i[t]
        })
      }(a);
      n("fff6");
      var o = n("2877"),
        s = Object(o.a)(i.default, r.a, r.b, !1, null, "7dae658f", null);
      e.default = s.exports
    },
    "48cc": function (t, e, n) {},
    6744: function (t, e, n) {
      (function (t) {
        function r(t) {
          return t && t.__esModule ? t : {
            default: t
          }
        }

        function i(t, e) {
          return s(t) || o(t, e) || a()
        }

        function a() {
          throw new TypeError("Invalid attempt to destructure non-iterable instance")
        }

        function o(t, e) {
          if (Symbol.iterator in Object(t) || "[object Arguments]" === Object.prototype.toString.call(t)) {
            var n = [],
              r = !0,
              i = !1,
              a = void 0;
            try {
              for (var o, s = t[Symbol.iterator](); !(r = (o = s.next()).done) && (n.push(o.value), !e || n.length !== e); r = !0);
            } catch (t) {
              i = !0, a = t
            } finally {
              try {
                r || null == s.return || s.return()
              } finally {
                if (i) throw a
              }
            }
            return n
          }
        }

        function s(t) {
          if (Array.isArray(t)) return t
        }

        function c(t, e) {
          if (null == t) return {};
          var n, r, i = u(t, e);
          if (Object.getOwnPropertySymbols) {
            var a = Object.getOwnPropertySymbols(t);
            for (r = 0; r < a.length; r++) n = a[r], e.indexOf(n) >= 0 || Object.prototype.propertyIsEnumerable.call(t, n) && (i[n] = t[n])
          }
          return i
        }

        function u(t, e) {
          if (null == t) return {};
          var n, r, i = {},
            a = Object.keys(t);
          for (r = 0; r < a.length; r++) n = a[r], e.indexOf(n) >= 0 || (i[n] = t[n]);
          return i
        }

        function d(t, e, n, r, i, a, o) {
          try {
            var s = t[a](o),
              c = s.value
          } catch (t) {
            return void n(t)
          }
          s.done ? e(c) : Promise.resolve(c).then(r, i)
        }

        function f(t) {
          return function () {
            var e = this,
              n = arguments;
            return new Promise(function (r, i) {
              function a(t) {
                d(s, r, i, a, o, "next", t)
              }

              function o(t) {
                d(s, r, i, a, o, "throw", t)
              }
              var s = t.apply(e, n);
              a(void 0)
            })
          }
        }

        function l(t, e) {
          var n = Object.keys(t);
          if (Object.getOwnPropertySymbols) {
            var r = Object.getOwnPropertySymbols(t);
            e && (r = r.filter(function (e) {
              return Object.getOwnPropertyDescriptor(t, e).enumerable
            })), n.push.apply(n, r)
          }
          return n
        }

        function h(t) {
          for (var e = 1; e < arguments.length; e++) {
            var n = null != arguments[e] ? arguments[e] : {};
            e % 2 ? l(n, !0).forEach(function (e) {
              p(t, e, n[e])
            }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : l(n).forEach(function (e) {
              Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
            })
          }
          return t
        }

        function p(t, e, n) {
          return e in t ? Object.defineProperty(t, e, {
            value: n,
            enumerable: !0,
            configurable: !0,
            writable: !0
          }) : t[e] = n, t
        }
        Object.defineProperty(e, "__esModule", {
          value: !0
        }), e.default = void 0;
        var m = r(n("a34a")),
          v = n("2f62"),
          _ = r(n("a95b")),
          b = {
            name: "address-edit",
            data: function () {
              return {
                form: {
                  location: "",
                  latitude: "",
                  longitude: "",
                  id: "",
                  name: "",
                  mobile: "",
                  address: "",
                  province_id: 0,
                  city_id: 0,
                  district_id: 0,
                  detail: ""
                },
                is_refund_address: 0,
                detail_url: "",
                list: [],
                submit_status: !1,
                tt_area_show: !1,
                automatic: "",
                provinceString: "",
                cityString: "",
                areaString: ""
              }
            },
            computed: h({}, (0, v.mapState)({
              theme: function (t) {
                return t.mallConfig.theme
              }
            })),
            components: {
              appLayout: function () {
                return Promise.all([n.e("common/vendor"), n.e("components/basic-component/app-layout/app-layout")]).then(n.bind(null, "0b17"))
              },
              appAreaPicker: function () {
                return n.e("components/page-component/app-area-picker/app-area-picker").then(n.bind(null, "8e44"))
              },
              appTextArea: function () {
                return n.e("components/basic-component/app-textarea/app-textarea").then(n.bind(null, "47cb"))
              }
            },
            onLoad: function (e) {
              var n = this;
              this.getAutoInfo(), this.is_refund_address = e.is_refund_address ? e.is_refund_address : 0, e.is_refund_address > 0 ? (this.detail_url = this.$api.app_admin.refund_address_edit, t.setNavigationBarTitle({
                title: "编辑退货地址"
              })) : this.detail_url = this.$api.user.address_detail, e.form && (this.form = JSON.parse(e.form)), e.id > 0 ? (this.$showLoading({
                title: "加载中"
              }), this.$request({
                url: this.detail_url,
                data: e
              }).then(function (r) {
                if (n.$hideLoading(), 0 === r.code)
                  if (e.is_refund_address > 0) {
                    var i = r.data.detail;
                    n.getInfo(Object.assign({
                      detail: i.address_detail
                    }, i))
                  } else n.form = r.data.list;
                else t.showToast({
                  title: r.msg,
                  icon: "none"
                });
                n.tt_area_show = !0
              }).catch(function () {
                n.$hideLoading(), n.tt_area_show = !0
              })) : this.tt_area_show = !0
            },
            methods: {
              outputData: function (t) {
                console.log(t)
              },
              getAutoInfo: function () {
                var t = f(m.default.mark(function t() {
                  var e, n, r, i, a;
                  return m.default.wrap(function (t) {
                    for (;;) switch (t.prev = t.next) {
                      case 0:
                        return t.next = 2, this.$request({
                          url: this.$api.user.auto_address_info,
                          method: "get"
                        });
                      case 2:
                        0 === (e = t.sent).code && (n = JSON.parse(e.data), r = n.reduce(function (t, e) {
                          e.children;
                          var n = c(e, ["children"]);
                          return t.concat(n)
                        }, []), i = n.reduce(function (t, e) {
                          return t.concat(e.children.map(function (t) {
                            return t.children, h({}, c(t, ["children"]), {
                              provinceCode: e.code
                            })
                          }))
                        }, []), a = n.reduce(function (t, e) {
                          var n = e.code;
                          return t.concat(e.children.reduce(function (t, e) {
                            var r = e.code;
                            return t.concat(e.children.map(function (t) {
                              return t.children, h({}, c(t, ["children"]), {
                                cityCode: r,
                                provinceCode: n
                              })
                            }))
                          }, []))
                        }, []), this.provinceString = JSON.stringify(r), this.cityString = JSON.stringify(i), this.areaString = JSON.stringify(a));
                      case 4:
                      case "end":
                        return t.stop()
                    }
                  }, t, this)
                }));
                return function () {
                  return t.apply(this, arguments)
                }
              }(),
              getChooseLocation: function () {
                var e = f(m.default.mark(function e() {
                  var n, r, a, o, s, c;
                  return m.default.wrap(function (e) {
                    for (;;) switch (e.prev = e.next) {
                      case 0:
                        return n = this, e.next = 3, t.chooseLocation();
                      case 3:
                        r = e.sent, a = i(r, 2), o = a[0], (s = a[1]) && (n.form.location = s.name, n.form.detail = s.address, n.form.latitude = s.latitude, n.form.longitude = s.longitude), o && (c = function () {
                          t.showModal({
                            title: "授权权限",
                            content: "请先授权地理位置权限",
                            success: function (e) {
                              e.confirm && t.openSetting({
                                success: function (e) {
                                  e.authSetting["scope.userLocation"] ? t.chooseLocation({
                                    success: function (t) {
                                      n.form.location = t.name, n.form.detail = t.address, n.form.latitude = t.latitude, n.form.longitude = t.longitude
                                    }
                                  }) : t.showToast({
                                    title: "授权失败",
                                    icon: "none"
                                  })
                                }
                              })
                            }
                          })
                        }, "chooseLocation:fail auth deny" === o.errMsg && c());
                      case 9:
                      case "end":
                        return e.stop()
                    }
                  }, e, this)
                }));
                return function () {
                  return e.apply(this, arguments)
                }
              }(),
              getInfo: function (e) {
                var n = this;
                this.$request({
                  url: this.$api.user.wechat_district,
                  data: {
                    province_name: e.address[0],
                    city_name: e.address[1],
                    county_name: e.address[2]
                  }
                }).then(function (t) {
                  if (0 === t.code) {
                    var r = t.data.district,
                      i = r.province,
                      a = r.city,
                      o = r.district;
                    e.province_id = i.id, e.city_id = a.id, e.district_id = o.id, n.form = e
                  }
                }).catch(function () {
                  t.showToast({
                    title: "网络异常",
                    icon: "none"
                  })
                })
              },
              areaEvent: function (t) {
                t && (this.form.province_id = t.province.id, this.form.city_id = t.city.id, this.form.district_id = t.district.id, this.list = [t.province.name, t.city.name, t.district.name])
              },
              submit: function () {
                var e = f(m.default.mark(function e() {
                  var n, r, i, a, o, s, c, u, d;
                  return m.default.wrap(function (e) {
                    for (;;) switch (e.prev = e.next) {
                      case 0:
                        if (e.prev = 0, !this.submit_status) {
                          e.next = 3;
                          break
                        }
                        return e.abrupt("return");
                      case 3:
                        if (this.form.detail || (n = "详细地址不能为空"), this.form.province_id || (n = "地区不能为空"), this.form.mobile || (n = "联系方式不能为空"), this.form.name || (n = "姓名不能为空"), !n) {
                          e.next = 10;
                          break
                        }
                        return t.showToast({
                          title: n,
                          icon: "none"
                        }), e.abrupt("return");
                      case 10:
                        return this.submit_status = !0, r = this.$api.user.address_save, i = this.form, this.is_refund_address > 0 && (r = this.$api.app_admin.refund_address_edit, a = this.form, o = a.id, s = a.name, c = a.mobile, u = a.detail, i = {
                          form: JSON.stringify({
                            id: o,
                            name: s,
                            mobile: c,
                            address_detail: u,
                            address: this.list,
                            is_default: 0,
                            remark: ""
                          })
                        }), e.next = 16, this.$request({
                          url: r,
                          data: i,
                          method: "POST"
                        });
                      case 16:
                        d = e.sent, this.submit_status = !1, 0 === d.code ? (t.showToast({
                          title: d.msg,
                          icon: "none"
                        }), t.navigateBack({
                          delta: 1
                        })) : t.showToast({
                          title: d.msg,
                          icon: "none"
                        }), e.next = 25;
                        break;
                      case 21:
                        throw e.prev = 21, e.t0 = e.catch(0), this.submit_status = !1, new Error(e.t0);
                      case 25:
                      case "end":
                        return e.stop()
                    }
                  }, e, this, [
                    [0, 21]
                  ])
                }));
                return function () {
                  return e.apply(this, arguments)
                }
              }(),
              getAddress: function () {
                var e = (0, _.default)(this.automatic, {}, this.provinceString, this.cityString, this.areaString);
                if (0 !== Object.keys(e).length) {
                  for (var n = t.getStorageSync("_DISTRICT"), r = e.name, i = e.province, a = e.city, o = e.area, s = e.phone, c = e.detail, u = 0; u < n.length; u++)
                    if (n[u].name === i) {
                      for (var d = 0; d < n[u].list.length; d++)
                        if (n[u].list[d].name === a) {
                          for (var f = 0; f < n[u].list[d].list.length; f++)
                            if (n[u].list[d].list[f].name === o) {
                              this.form.province_id = n[u].id, this.form.city_id = n[u].list[d].id, this.form.district_id = n[u].list[d].list[f].id;
                              break
                            } break
                        } break
                    } this.form.name = r, this.form.detail = "".concat(c), this.form.mobile = s
                }
              }
            }
          };
        e.default = b
      }).call(this, n("543d").default)
    },
    "67cd": function (t, e, n) {
      n.r(e);
      var r = n("6744"),
        i = n.n(r);
      for (var a in r) "default" !== a && function (t) {
        n.d(e, t, function () {
          return r[t]
        })
      }(a);
      e.default = i.a
    },
    d79e: function (t, e, n) {
      var r = function () {
          var t = this;
          t.$createElement;
          t._self._c
        },
        i = [];
      n.d(e, "a", function () {
        return r
      }), n.d(e, "b", function () {
        return i
      })
    },
    fff6: function (t, e, n) {
      var r = n("48cc");
      n.n(r).a
    }
  },
  [
    ["617f", "common/runtime", "common/vendor"]
  ]
]);